package com.iddaa.core.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iddaa.core.dao.AccountDAO;
import com.iddaa.core.domain.Account;
import com.iddaa.core.exception.AuthenticationException;
import com.iddaa.core.service.AccountService;

@Service("accountService")
public class AccountServiceImpl implements AccountService {

	@Autowired
	private AccountDAO accountDAO;

	@Override
	public Account authentication(String username, String password) {
		Account account = accountDAO.authentication(username, password);
		if (account == null) {
			throw new AuthenticationException(username);
		}
		return account;
	}

}
